package com.atguigu.eduservice.controller.frontController;

import com.atguigu.commonutils.R;
import com.atguigu.eduservice.entity.EduCourse;
import com.atguigu.eduservice.entity.EduTeacher;
import com.atguigu.eduservice.service.EduCourseService;
import com.atguigu.eduservice.service.EduTeacherService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.ReactiveTransaction;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author cyt
 * @create 2020-05-14 11:53
 */

@Api(description = "首页信息")
@RestController
@RequestMapping("/eduservice/indexinfo")
public class indexController {

    @Autowired
    EduCourseService eduCourseService;

    @Autowired
    EduTeacherService eduTeacherService;

    // 热门讲师
    @GetMapping("/hotTeacher")
    public R hotTeacher() {
        List<EduTeacher> list = eduTeacherService.gethotTeacher();
        return R.ok().data("hotTeacher", list);
    }


    // 热门课程
    @GetMapping("/hotCourse")
    public R hotCourse() {
        List<EduCourse> list = eduCourseService.gethotCourse();
        return R.ok().data("hotCourse", list);
    }
}
